home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++)))) RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++))))
-
-
-
- NNNNaaaammmmeeee
- RWTBitVec<size> - Rogue Wave library class
-
- SSSSyyyynnnnooooppppssssiiiissss
- #include <rw/tbitvec.h>
-
-
-
- RWTBitVec<22> // A 22 bit long vector
-
-
-
-
- DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc<<<<ssssiiiizzzzeeee>>>> is a parameterized bit vector of fixed length ssssiiiizzzzeeee.
- Unlike class RRRRWWWWBBBBiiiittttVVVVeeeecccc, its length cannot be changed at run time. The
- advantage of RRRRWWWWBBBBiiiittttVVVVeeeecccc is its smaller size, and one less level of
- indirection, resulting in a slight speed advantage. Bits are numbered
- from 0 through ssssiiiizzzzeeee----1111, inclusive. The copy constructor and assignment
- operator use ccccooooppppyyyy semantics.
-
- PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
- None
-
- EEEExxxxaaaammmmpppplllleeee
- In this example, a bit vector 24 bits long is exercised:
-
- #include <rw/tbitvec.h>
-
-
-
- main() {
- RWTBitVec<24> a, b; // Allocate two vectors.
- a(2) = TRUE; // Set bit 2 (the third bit) of a on.
- b(3) = TRUE; // Set bit 3 (the fourth bit) of b on.
- RWTBitVec<24> c = a ^ b; // Set c to the XOR of a and b.
- }
-
-
-
- PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc<<<<ssssiiiizzzzeeee>>>>();
-
-
- Constructs an instance with all bits set to FFFFAAAALLLLSSSSEEEE.
-
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc<<<<ssssiiiizzzzeeee>>>>(RWBoolean val);
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++)))) RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++))))
-
-
-
- Constructs an instance with all bits set to vvvvaaaallll.
-
- AAAAssssssssiiiiggggnnnnmmmmeeeennnntttt OOOOppppeeeerrrraaaattttoooorrrrssss
- RWTBitVec<size>&
- ooooppppeeeerrrraaaattttoooorrrr====(const RWTBitVec<size>& v);
-
-
- Sets self to a copy of vvvv.
-
- RWTBitVec&
- ooooppppeeeerrrraaaattttoooorrrr====(RWBoolean val);
-
-
- Sets all bits in self to the value vvvvaaaallll.
-
- RWTBitVec&
- ooooppppeeeerrrraaaattttoooorrrr&&&&====(const RWTBitVec& v);
- RWTBitVec&
- ooooppppeeeerrrraaaattttoooorrrr^^^^====(const RWTBitVec& v);
- RWTBitVec&
- ooooppppeeeerrrraaaattttoooorrrr||||====(const RWTBitVec& v);
-
-
- Logical assignments. Sets each bit of self to the logical AAAANNNNDDDD, XXXXOOOORRRR, or
- OOOORRRR, respectively, of self and the corresponding bit in vvvv.
-
- RWBitRef
- ooooppppeeeerrrraaaattttoooorrrr[[[[]]]](size_t i);
-
-
- Returns a reference to the iiiith bit of self. This reference can be used
- as an lvalue. The index iiii must be between 0000 and ssssiiiizzzzeeee----1111, inclusive.
- Bounds checking will occur.
-
- RWBitRef
- ooooppppeeeerrrraaaattttoooorrrr(((())))(size_t i);
-
-
- Returns a reference to the iiiith bit of self. This reference can be used
- as an lvalue. The index iiii must be between 0000 and ssssiiiizzzzeeee----1111, inclusive. No
- bounds checking is done.
-
- LLLLooooggggiiiiccccaaaallll OOOOppppeeeerrrraaaattttoooorrrrssss
- RWBoolean
- ooooppppeeeerrrraaaattttoooorrrr========(RWBoolean b) const;
-
-
- Returns TTTTRRRRUUUUEEEE if every bit of self is set to the value bbbb. Otherwise,
- returns FFFFAAAALLLLSSSSEEEE.
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++)))) RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++))))
-
-
-
- RWBoolean
- ooooppppeeeerrrraaaattttoooorrrr!!!!====(RWBoolean b) const;
-
-
- Returns TTTTRRRRUUUUEEEE if any bit of self is not set to the value bbbb. Otherwise,
- returns FFFFAAAALLLLSSSSEEEE.
-
- RWBoolean
- ooooppppeeeerrrraaaattttoooorrrr========(const RWTBitVec& v) const;
-
-
- Returns TTTTRRRRUUUUEEEE if each bit of self is set to the same value as the
- corresponding bit in vvvv. Otherwise, returns FFFFAAAALLLLSSSSEEEE.
-
- RWBoolean
- ooooppppeeeerrrraaaattttoooorrrr!!!!====(const RWTBitVec& v) const;
-
-
- Returns TTTTRRRRUUUUEEEE if any bit of self is not set to the same value as the
- corresponding bit in vvvv. Otherwise, returns FFFFAAAALLLLSSSSEEEE.
-
- void
- cccclllleeeeaaaarrrrBBBBiiiitttt(size_t i);
-
-
- Clears (iiii....eeee...., sets to FFFFAAAALLLLSSSSEEEE) the bit with index iiii. The index iiii must be
- between 0 and ssssiiiizzzzeeee----1111. No bounds checking is performed. The following
- two lines are equivalent, although cccclllleeeeaaaarrrrBBBBiiiitttt((((ssssiiiizzzzeeee____tttt)))) is slightly smaller
- and faster than using ooooppppeeeerrrraaaattttoooorrrr(((())))((((ssssiiiizzzzeeee____tttt)))):
-
- a(i) = FALSE;
-
-
-
- a.clearBit(i);
-
-
-
-
- const RWByte*
- ddddaaaattttaaaa() const;
-
-
- Returns a ccccoooonnnnsssstttt pointer to the raw data of self. Should be used with
- care.
-
- size_t
- ffffiiiirrrrssssttttFFFFaaaallllsssseeee() const;
-
-
- Returns the index of the first OOOOFFFFFFFF (False) bit in self. Returns RRRRWWWW____NNNNPPPPOOOOSSSS
- if there is no OOOOFFFFFFFF bit.
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++)))) RRRRWWWWTTTTBBBBiiiittttVVVVeeeecccc((((3333CCCC++++++++))))
-
-
-
- size_t
- ffffiiiirrrrssssttttTTTTrrrruuuueeee() const;
-
-
- Returns the index of the first OOOONNNN (True) bit in self. Returns RRRRWWWW____NNNNPPPPOOOOSSSS if
- there is no OOOONNNN bit.
-
- void
- sssseeeettttBBBBiiiitttt(size_t i);
-
-
- Sets (iiii....eeee...., sets to TTTTRRRRUUUUEEEE) the bit with index iiii. The index iiii must be
- between 0 and ssssiiiizzzzeeee----1111. No bounds checking is performed. The following
- two lines are equivalent, although sssseeeettttBBBBiiiitttt((((ssssiiiizzzzeeee____tttt)))) is slightly smaller and
- faster than using ooooppppeeeerrrraaaattttoooorrrr(((())))((((ssssiiiizzzzeeee____tttt))))
-
- a(i) = TRUE;
-
-
-
- a.setBit(i);
-
-
-
-
- RWBoolean
- tttteeeessssttttBBBBiiiitttt(size_t i) const;
-
-
- Tests the bit with index iiii. The index iiii must be between 0 and ssssiiiizzzzeeee----1111.
- No bounds checking is performed. The following are equivalent, although
- tttteeeessssttttBBBBiiiitttt((((ssssiiiizzzzeeee____tttt)))) is slightly smaller and faster than using
- ooooppppeeeerrrraaaattttoooorrrr(((())))((((ssssiiiizzzzeeee____tttt)))):
-
- if( a(i) ) doSomething();
-
-
-
- if( a.testBit(i) ) doSomething();
-
-
-
- RRRReeeellllaaaatttteeeedddd GGGGlllloooobbbbaaaallll FFFFuuuunnnnccccttttiiiioooonnnnssss
- RWTBitVec ooooppppeeeerrrraaaattttoooorrrr&&&&(const RWTBitVec& v1, const RWTBitVec& v2);
- RWTBitVec ooooppppeeeerrrraaaattttoooorrrr^^^^(const RWTBitVec& v1, const RWTBitVec& v2);
- RWTBitVec ooooppppeeeerrrraaaattttoooorrrr||||(const RWTBitVec& v1, const RWTBitVec& v2);
-
-
- Return the logical AAAANNNNDDDD, XXXXOOOORRRR, and OOOORRRR, respectively, of vectors vvvv1111 and vvvv2222.
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-